/**
 * 判断是否有权限。根据传入的权限标识，查看是否存在于用户的权限标识集合内。
 */
export function hasPermission(perms) {
  let hasPermission = false;
  let userresource = JSON.parse(localStorage.getItem("userresource"));

  let nbcUser = JSON.parse(localStorage.getItem("nbcUserInfo"));
  if (nbcUser && nbcUser.UserName == "admin") {
    hasPermission = true;
    return hasPermission;
  } else {
    if (perms == null || perms == "") {
      hasPermission = false;
    }
    if (userresource && userresource.length > 0) {
      hasPermission = userresource.some((item) => {
        return item.toLowerCase() === perms.toLowerCase();
      });
    }
  }
  if (hasPermission == false) {
    this.$message.error("暂无权限操作");
  }
  return hasPermission;
}
